package com.da.javatest.leetCode;

/**
 * @author chenlida
 * @date 2019/3/15 10:51
 * @description
 */
public class Code605 {
    public boolean canPlaceFlowers(int[] flowerbed, int n) {
        StringBuilder sb = new StringBuilder("0");
        for (int i : flowerbed) {
            sb.append(i);
        }
        sb.append("0");
        String[] split = sb.toString().split("1");
        for (String s : split) {
            n -= (s.length() - 1) / 2;
        }
        return n <= 0;
    }
}
